<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    function convert(str) {
        let obj = {};
        for (let i = 0; i < str.length; i++) {
            if (obj[str[i]]) {
                obj[str[i]] += 1;
            } else {
                obj[str[i]] = 1
            }
        }
        let str1 = "";
        for (let key in obj) {
            str1 += key + obj[key]
        }
        return str1
    }
    console.log(convert("aaabbv"))
</script>